/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       capsule.h
 * Author:     karooolek
 * Created on: 2009-10-08
 *
 **********************************************************************************************************************/

#ifndef CAPSULE_H_
#define CAPSULE_H_

#include "shape.h"
#include "vector3.h"

namespace mGameEngine
{

/**
 * Capsule in three-dimensional space.
 * Capsule is a ray segment with radius.
 */
class Capsule : public Shape
{
private:
    /**
     * Start.
     */
    Vector3 _a;

    /**
     * End.
     */
    Vector3 _b;

    /**
     * Radius.
     */
    float _r;

public:
    /**
     * Create capsule with specified ends and radius.
     * @param a start.
     * @param b end.
     * @param radius radius.
     */
    Capsule(const Vector3 &a = Vector3(),
            const Vector3 &b = Vector3(1.0f, 0.0f, 0.0f),
            float radius = 1.0f);

    /**
     * Destroy capsule.
     */
    ~Capsule();

    /**
     * Get capsule segment start.
     * @return capsule segment start.
     */
    const Vector3 &getStart() const
    {
        return _a;
    }

    /**
     * Set capsule segment start.
     * @param a segment start.
     */
    void setStart(const Vector3 &a)
    {
        _a = a;
    }

    /**
     * Get capsule segment end.
     * @return capsule segment end.
     */
    const Vector3 &getEnd() const
    {
        return _b;
    }

    /**
     * Set capsule segment end.
     * @param b segment end.
     */
    void setEnd(const Vector3 &b)
    {
        _b = b;
    }

    /**
     * Get capsule radius.
     * @return capsule radius.
     */
    float getRadius() const
    {
        return _r;
    }

    /**
     * Set capsule radius.
     * @param r radius (non-negative).
     */
    void setRadius(float r)
    {
        _r = r;
    }
};

}

#endif // CAPSULE_H_
